//
//  HomePageTool.m
//  MindBox
//
//  Created by MS on 16-1-1.
//  Copyright (c) 2016年 Lemon. All rights reserved.
//

#import "HomePageTool.h"
#import "LGHttpTool.h"
#import "INTERFACE.h"
#import "MJExtension.h"
@implementation HomePageTool
+ (void)homePageDataWithSuccess:(void (^)( Data * data))success
                        failure:(void (^)( NSError *error))failure;
{
    
    [LGHttpTool GET:HOME_URL parameters:nil success:^(id responseObject) {
        
        HomeModel * homeData = [HomeModel mj_objectWithKeyValues:responseObject];
        Data * data = homeData.data;
        
        if (success) {
            
            success(data);
        }
        
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];
    
}

+ (void)homePageGoodsDataWithPages:(int)pages Success:(void (^)( NSArray * dataArray))success
                             failure:(void (^)( NSError *error))failure
{
    
    NSString * urlStr = HOME_GOODS_URL(pages);
    
    [LGHttpTool GET:urlStr parameters:nil success:^(id responseObject) {
        
        HomeGoodsModel * goodsData = [HomeGoodsModel mj_objectWithKeyValues:responseObject];
        NSArray * data = goodsData.data;
        
        if (success) {
            
            success(data);
        }
        
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];

    
    
}

//http://app.xinyihezi.com:8888/good/?label=homepage&page=1&page_size=10&unique_id=A542680E-BEFE-4CEF-8454-DC677F28744C&app_ver=2.2.2&from_type=iOS
@end
